from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import datetime


class UserResponse(BaseModel):
    id: Optional[int] = Field(None, description="用户ID")
    username: str
    name: Optional[str] = None
    avatar: Optional[str] = None
    email: Optional[str] = None
    phone: Optional[str] = None
    status: Optional[int] = None
    department: Optional[str] = None
    dept_name:Optional[str] = None
    person_id: Optional[int] = None
    roles: Optional[List[int]] = None
    create_time: Optional[datetime] = None
    update_time: Optional[datetime] = None

    class Config:
        from_attributes = True


class UserListResponse(BaseModel):
    total: int = Field(..., description="总数量")
    items: List[UserResponse] = Field(..., description="用户列表")
    page: int = Field(..., description="页码")
    size: int = Field(..., description="每页数量")
    pages: int = Field(..., description="总页数")